cssimage: Fallback images have no aspect ratio
authorBenjamin Otte <otte@redhat.com>
Fri, 13 Jan 2017 00:43:07 +0000 (01:43 +0100)
committerBenjamin Otte <otte@redhat.com>
Fri, 13 Jan 2017 02:38:36 +0000 (03:38 +0100)
The aspect ratio for fallback image was incorrectly set to 1.

Reftest is included.

gtk/gtkcssimagefallback.c
testsuite/reftests/Makefile.am
testsuite/reftests/css-image-color-aspect-ratio.css [new file with mode: 0644]
testsuite/reftests/css-image-color-aspect-ratio.ref.ui [new file with mode: 0644]
testsuite/reftests/css-image-color-aspect-ratio.ui [new file with mode: 0644]

index 316f4223774251745aea6aac944b37b601c4e1fd..a1f74e6859846f3e803a2b5d8538038cf697eb3b 100644 (file)
@@ -56,7 +56,7 @@ gtk_css_image_fallback_get_aspect_ratio (GtkCssImage *image)
   GtkCssImageFallback *fallback = GTK_CSS_IMAGE_FALLBACK (image);
 
   if (fallback->used < 0)
-    return 1;
+    return 0;
 
   return _gtk_css_image_get_aspect_ratio (fallback->images[fallback->used]);
 }
index 31645d23f03791e266ee6d78bd88488d31b3a306..8644e1cdfb8474cf14e3cf658c8f170099f4d7a5 100644 (file)
@@ -201,6 +201,9 @@ testdata = \
        css-image-aspect-ratio.css \
        css-image-aspect-ratio.ui \
        css-image-aspect-ratio.ref.ui \
+       css-image-color-aspect-ratio.css \
+       css-image-color-aspect-ratio.ui \
+       css-image-color-aspect-ratio.ref.ui \
        css-match-class.css \
        css-match-class.ref.ui \
        css-match-class.ui \
diff --git a/testsuite/reftests/css-image-color-aspect-ratio.css b/testsuite/reftests/css-image-color-aspect-ratio.css
new file mode 100644 (file)
index 0000000..6c83a76
--- /dev/null
@@ -0,0 +1,9 @@
+window {
+  background-color: blue;
+  background-image: image(red);
+  background-repeat: no-repeat;
+}
+
+#reference {
+  background: red;
+}
diff --git a/testsuite/reftests/css-image-color-aspect-ratio.ref.ui b/testsuite/reftests/css-image-color-aspect-ratio.ref.ui
new file mode 100644 (file)
index 0000000..982e3d8
--- /dev/null
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <!-- interface-requires gtk+ 3.0 -->
+  <object class="GtkWindow" id="window1">
+    <property name="width_request">20</property>
+    <property name="height_request">10</property>
+    <property name="can_focus">False</property>
+    <property name="type">popup</property>
+    <property name="name">reference</property>
+  </object>
+</interface>
diff --git a/testsuite/reftests/css-image-color-aspect-ratio.ui b/testsuite/reftests/css-image-color-aspect-ratio.ui
new file mode 100644 (file)
index 0000000..d264856
--- /dev/null
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <!-- interface-requires gtk+ 3.0 -->
+  <object class="GtkWindow" id="window1">
+    <property name="width_request">20</property>
+    <property name="height_request">10</property>
+    <property name="can_focus">False</property>
+    <property name="type">popup</property>
+  </object>
+</interface>